package com.goudan.ojcloudjudgeservice.codesandbox.impl;
// 建议dashscope SDK的版本 >= 2.12.0
import java.util.Arrays;
import java.lang.System;
import com.goudan.ojmodel.codesandbox.ExecuteCodeRequest;
import com.goudan.ojmodel.codesandbox.ExecuteCodeResponse;

public class ChatMain {
    public  void main(String[] args) {
        ThirdPartyCodeSandbox sandbox = new ThirdPartyCodeSandbox();
        // 构造请求
        ExecuteCodeRequest request = new ExecuteCodeRequest();
        request.setLanguage("java");
        request.setCode(
                "import java.util.Scanner;\n" +
                        "public class Main {\n" +
                        "  public static void main(String[] args) {\n" +
                        "    Scanner sc = new Scanner(System.in);\n" +
                        "    int a = sc.nextInt();\n" +
                        "    int b = sc.nextInt();\n" +
                        "    System.out.println(a + b);\n" +
                        "  }\n" +
                        "}"
        );
        request.setInputList(Arrays.asList("3 5", "10 20"));
        // 执行
        ExecuteCodeResponse response = sandbox.executeCode(request);

        // 输出结果
        System.out.println(response);
    }
}
